<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Label;
use App\Models\admin_user;
class dpwd_admin extends \Illuminate\Routing\Controller
{
     public function dpwd_admin(Request $request)
     {
         $user=new admin_user();
         $session=$request->session()->get('admin_user_name');
         $users=$user->where('admin_user_name',$session)->first();
        return view('dpwd',['users'=>$users]);
     }
     public function dpwd_admin_ok(Request $request)
     {
         $pwd=md5($request->input('pwd'));
         $session=$request->session()->get('admin_user_name');
         $user=new admin_user();
         $users=$user->where('admin_user_name',$session)->update(['admin_user_pwd'=>$pwd]);
         if($users==""){
             echo '新密码不能为空或新密码与旧密码相符';
         }else{
             return '修改成功'.'<a href="/admin_admin">点击回到首页</a>';
         }
     }
}
